#include<bits/stdc++.h>
using namespace std;
const long long MOD = 7528443412579576937;
const __int128 one = 1;
struct mat{
    long long f[2][2];
    friend mat operator*(mat va,mat vb){
        mat res;
        res.f[0][0] = (one*va.f[0][0]*vb.f[0][0]%MOD + one*va.f[0][1]*vb.f[1][0]%MOD)%MOD;
        res.f[0][1] = (one*va.f[0][0]*vb.f[0][1]%MOD + one*va.f[0][1]*vb.f[1][1]%MOD)%MOD;
        res.f[1][0] = (one*va.f[1][0]*vb.f[0][0]%MOD + one*va.f[1][1]*vb.f[1][0]%MOD)%MOD;
        res.f[1][1] = (one*va.f[1][0]*vb.f[0][1]%MOD + one*va.f[1][1]*vb.f[1][1]%MOD)%MOD;
        return res;
    }
};
int main(){
    long long b,d,n;
    cin>>b>>d>>n;
    if(n == 0){
        cout<<1<<'\n';
        return 0;
    }
    mat base;
    base.f[0][0] = b;
    base.f[0][1] = (MOD - ((b*b - d)/4)%MOD)%MOD;
    base.f[1][0] = 1;
    base.f[1][1] = 0;
    mat res;
    res.f[0][0] = 1;
    res.f[0][1] = 0;
    res.f[1][0] = 0;
    res.f[1][1] = 1;
    long long yn = n;
    n--;
    while(n){
        if(n&1){
            res = base*res;
        }
        base = base*base;
        n >>= 1;
    }
    long long res1 = (res.f[0][0]*one*b%MOD + one*res.f[0][1]*2%MOD)%MOD;
    if(yn % 2 == 1){
        cout<<res1<<'\n';
    }else{
        cout<<((long long)(res1 - 1)%MOD)<<'\n';
    }
}